<template>
  <div class="dashboard-container">
    <div class="dashboard-text">name: {{ name }}</div>
    <h1>{{ count }}</h1>
    <button @click="changeOppCount">点我加1</button>
  </div>
</template>

<script>
import { mapGetters,mapState } from 'vuex'

export default {
  name: '首页',
  computed: {
    ...mapGetters([
      'name'
    ]),
    ...mapState('opp',{
      count:state => state.count
    }),
  },
  mounted(){
    console.log(this.count);
  },
  methods:{
    changeOppCount(){
      this.$store.dispatch('opp/changeCount')
    }
  }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
